import Vue from 'vue'
import App from './App.vue'
import "bulma/bulma.sass"
import Mint from 'mint-ui';
import "mint-ui/lib/style.css"

Vue.use(Mint);

let cookbook = [
    '杨国福麻辣烫',
    '东方宫牛肉面',
    '西直门美食广场',
    '美味米线',
    '张亮麻辣烫',
    '小食驿站',
    '香河肉饼',
    '牛肉板面',
    '重庆的麻辣烫',
    '如意川味小吃',
    '郭记麻辣烫'
]

new Vue({
    el: '#app',
    data(){
        return {
            resturant: '',
            flag:false,
            timer:false,
            //selected:'外卖',
            //active:'tab-container1'
        }
    },
    methods: {
        randomResturant(){
            this.timer = setInterval(this.changeResturant,50)
        },
        changeResturant(){
            let index = (parseInt(Math.random() * 100) % cookbook.length);
            this.resturant = cookbook[index];
        },
        startChange(){
            this.flag = true;
            this.randomResturant();
        },
        stopChange(){
            this.flag = false;
            clearInterval(this.timer);  //setinterval停止要用clearInteral，否则再次运行setinterval表示2个setinterval同时在运行，效果表现为执行间隔时间减小
        }
    }
})
